package com.micro.ai.agents.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 消息实体类
 * 
 * @author micro-ai
 * @since 0.0.1
 */
@Data
@TableName("messages")
@Schema(description = "消息信息")
public class Message implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @Schema(description = "消息ID", example = "msg_123456789")
    private String id;

    @Schema(description = "租户ID", example = "tenant_001")
    private String tenantId;

    @Schema(description = "会话ID", example = "conv_123")
    private String conversationId;

    @Schema(description = "角色", example = "user", allowableValues = {"user", "assistant", "system", "tool", "function"})
    private String role;

    @Schema(description = "消息内容", example = "你好，我想了解一下产品")
    private String content;

    @Schema(description = "消息类型", example = "text", allowableValues = {"text", "image", "file"})
    private String messageType;

    @Schema(description = "使用的token数", example = "100")
    private Integer tokensUsed;

    @Schema(description = "输入token数", example = "50")
    private Integer inputTokens;

    @Schema(description = "输出token数", example = "50")
    private Integer outputTokens;

    @Schema(description = "响应时间（毫秒）", example = "500")
    private Integer responseTimeMs;

    @Schema(description = "消息顺序", example = "1")
    private Integer messageOrder;

    @Schema(description = "使用的模型", example = "gpt-4")
    private String modelUsed;

    @Schema(description = "消息成本", example = "0.001")
    private BigDecimal cost;

    @Schema(description = "元数据（JSON）")
    private String metadata;

    @TableField(fill = FieldFill.INSERT)
    @Schema(description = "创建时间")
    private LocalDateTime createdAt;
}

